package main

import (
	"fmt"
	"strconv"
	"time"
)

//测试时间工具
func main() {
	// now := time.Now()
	// fmt.Printf("now's type = %T,\nnow's value = %v \n", now, now)

	// year := now.Year()
	// fmt.Printf("year's type = %T,\nyear's value = %v \n", year, year)

	// month := now.Month()
	// fmt.Printf("month's type = %T,\nmonth's value = %v \n", month, month)

	// day := now.Day()
	// fmt.Printf("day's type = %T,\nday's value = %v \n", day, day)

	// hour := now.Hour()
	// fmt.Printf("hour's type = %T,\nhour's value = %v \n", hour, hour)

	// minute := now.Minute()
	// fmt.Printf("minute's type = %T,\nminute's value = %v \n", minute, minute)

	// second := now.Second()
	// fmt.Printf("second's type = %T,\nsecond's value = %v \n", second, second)

	// fmt.Printf("当前年月日时分秒 %d-%d-%d %d:%d:%d\n", year, month, day, hour, minute, second)

	// dateStr := fmt.Sprintf("当前年月日时分秒 %d-%d-%d %d:%d:%d", year, month, day, hour, minute, second)
	// fmt.Println(dateStr)

	// fmt.Printf(now.Format("2022-07-21 13:36:20"))
	// fmt.Println()

	// i := 0
	// for {
	// 	i++
	// 	fmt.Println(i)
	// 	//休眠 1毫秒 * n
	// 	time.Sleep(time.Millisecond * 1000)
	// 	if i == 60 {
	// 		break
	// 	}
	// }

	//Unix 和 UnixNano的使用
	// unixTimeStamp := time.Now().Unix()
	// unixNanoTimeStamp := time.Now().UnixNano()
	// fmt.Printf("unix=%v,unixNano=%v\n", unixTimeStamp, unixNanoTimeStamp)

	start := time.Now().Unix()
	test03()
	end := time.Now().Unix()
	fmt.Printf("test03方法运行的时间为%v秒\n", end-start)
}

func test03() {
	str := ""
	// panic("unimplemented")
	for i := 0; i < 100000; i++ {
		str += "hello" + strconv.Itoa(i)
		// fmt.Println(str)
	}
}
